<?php
/**
 * GoodsPhotoModel.php
 * Created by PhpStorm.
 * User: 江小波
 * Date: 2019/05/11
 * Time: 15:59
 */
namespace app\api\model;

use app\common\Singleton;
use think\Db;

class GoodsPhotoModel
{
    use Singleton;

    public function save($flag,$data,$extend=[])
    {
        if(empty($flag))
        {
            // 添加
            $data['create_ts'] = time();
            return Db::name('goods')
                ->insertGetId($data);
        }
        else
        {
            // 编辑
            $data['update_ts'] = time();
            return Db::name('goods')
                ->where('id',$flag)
                ->update($data);
        }
    }
}